]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Hide search providers which are blacklisted by parental controls
authorPhilip Withnall <withnall@endlessm.com>
Mon, 30 Mar 2020 11:40:11 +0000 (12:40 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 7 Apr 2020 15:47:33 +0000 (17:47 +0200)
If a search provider is installed by an app which is blacklisted for the
current user by their parental controls, don’t show it or results for
it.

Currently, this only filters ‘remote’ (not built-in to the shell) search
providers. This seems fine for now; in future it could be expanded to
also filter built-in search providers, if any of them end up needing to
be filtered.

No corresponding changes need to be made `remoteSearch.js`, because the
results of `loadRemoteSearchProviders()` are filtered in `search.js`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/465

js/ui/search.js

index 88f06211c4f6ccb473ecee530b8030ef6b655085..f9125123e6599f6d8e4c6602851e4f3cf317b25d 100644 (file)
@@ -6,6 +6,7 @@ const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
 const AppDisplay = imports.ui.appDisplay;
 const IconGrid = imports.ui.iconGrid;
 const Main = imports.ui.main;
+const ParentalControlsManager = imports.misc.parentalControlsManager;
 const RemoteSearch = imports.ui.remoteSearch;
 const Util = imports.misc.util;
 
@@ -431,6 +432,9 @@ var SearchResultsView = GObject.registerClass({
     _init() {
         super._init({ name: 'searchResults', vertical: true });
 
+        this._parentalControlsManager = ParentalControlsManager.getDefault();
+        this._parentalControlsManager.connect('app-filter-changed', this._reloadRemoteProviders.bind(this));
+
         this._content = new MaxWidthBox({
             name: 'searchResultsContent',
             vertical: true,
@@ -505,6 +509,11 @@ var SearchResultsView = GObject.registerClass({
 
     _registerProvider(provider) {
         provider.searchInProgress = false;
+
+        // Filter out unwanted providers.
+        if (provider.appInfo && !this._parentalControlsManager.shouldShowApp(provider.appInfo))
+            return;
+
         this._providers.push(provider);
         this._ensureProviderDisplay(provider);
     }